package com.pan.download5;

import com.pan.download5.config.ApplicationConfig;
import com.pan.download5.driver.Basic2Driver;
import com.pan.download5.driver.Driver;
import com.pan.download5.factory.DirectoryFactory;
import com.pan.download5.factory.PageFactory;
import com.pan.download5.factory.impl.Auto2DirectoryFactory;
import com.pan.download5.factory.impl.Auto2PageFactory;
import com.pan.download5.parse.Auto2XmlParser;

public class Auto2DownloadApplication {
    public static void main(String[] args) {
        String path = ApplicationConfig.INSTANCE.getAuto2CrawlerPath();
        Auto2XmlParser auto2XmlParser = new Auto2XmlParser(path);
        DirectoryFactory directoryFactory = new Auto2DirectoryFactory(auto2XmlParser.getDirectory());
        PageFactory pageFactory = new Auto2PageFactory(auto2XmlParser.getPage());
        Driver driver = new Basic2Driver(directoryFactory, pageFactory);

        int taskThreadCount = ApplicationConfig.INSTANCE.getTaskThreadCount();
        String targetCrawlerUrl = ApplicationConfig.INSTANCE.getTargetCrawlerUrl();
        driver.run(targetCrawlerUrl, taskThreadCount);
    }
}
